# -*- coding: utf-8 -*-
# @Time: 2025/11/9 9:14
# @Author: subencai
# @Email: 2080981057@qq.com
# @File: view02.py
# @Project: flaskProject
# @Description:
# from flask import Blueprint
# view02_bp = Blueprint("view02_bp",__name__,url_prefix="/v1")
#
# @view02_bp.route("/")
# def index():
#     return "this is view02_bp index"



# router/view02.py
from flask import Blueprint, jsonify

view02_bp = Blueprint("view02_bp", __name__, url_prefix="/v2")

# 1. 健康检查接口（用于验证服务是否正常运行）
@view02_bp.route("/health", methods=["GET"])
def health_check():
    return jsonify({"status": "ok", "message": "服务运行正常"})

# 2. 版本信息查询
@view02_bp.route("/version", methods=["GET"])
def get_version():
    return jsonify({
        "version": "1.0.0",
        "release_time": "2025-11-10",
        "description": "学生-老师管理系统"
    })

# 3. 服务器时间查询
@view02_bp.route("/time", methods=["GET"])
def get_server_time():
    import datetime
    now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    return jsonify({"server_time": now})